package com.farmUni.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class MyWebMvcConfigurer implements WebMvcConfigurer {
    @Value("${cityView.path}")
    private String uploadPath1;

    @Value("${cityView.iconPath}")
    private String uploadPath2;


    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/picture/**").addResourceLocations("file:"+uploadPath1);
        //以下添加更多：
        //registry.addResourceHandler("/picture/**").addResourceLocations("file:"+uploadPath);
        registry.addResourceHandler("/icon/**").addResourceLocations("file:"+uploadPath2);
    }
}